//
//  FMHotHostTableViewCell.m
//  PsychologyFM
//
//  Created by lanou on 16/1/21.
//  Copyright © 2016年 ZhangLuDu. All rights reserved.
//

#import "FMHotHostTableViewCell.h"
#import <UIImageView+WebCache.h>

@implementation FMHotHostTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addView];
    }
    
    return self;
}

- (void)addView
{
    _iconImageView = [[UIImageView alloc]initWithFrame:CGRectMake(15, 15, 60, 60)];
    _iconImageView.layer.cornerRadius = 30;
    _iconImageView.layer.masksToBounds = YES;
    
    _nicknameLabel = [[UILabel alloc]initWithFrame:CGRectMake(_iconImageView.right + 10, _iconImageView.top + 5, 100, 20)];
    _nicknameLabel.font = [UIFont systemFontOfSize:14];
    _nicknameLabel.textColor = FMBlack;
    _nicknameLabel.textAlignment = NSTextAlignmentLeft;
    
    _contentLabel = [[UILabel alloc]initWithFrame:CGRectMake(_iconImageView.right + 10, _nicknameLabel.bottom + 5, kScreenWidth - 100, 20)];
    _contentLabel.font = [UIFont systemFontOfSize:14];
    _contentLabel.textColor = FMGray;
    _contentLabel.numberOfLines = -1;
    _contentLabel.textAlignment = NSTextAlignmentLeft;
    
    _showNumLabel = [[UILabel alloc]initWithFrame:CGRectMake(kScreenWidth - 100, _nicknameLabel.top, 85, 20)];
    _showNumLabel.font = [UIFont systemFontOfSize:14];
    _showNumLabel.textColor = FMGray;
    _showNumLabel.textAlignment = NSTextAlignmentRight;
    
//    _iconImageView.backgroundColor = FMRed;
//    _nicknameLabel.backgroundColor = FMRed;
//    _contentLabel.backgroundColor = FMRed;
//    _showNumLabel.backgroundColor = FMRed;
    [self.contentView addSubview:_iconImageView];
    [self.contentView addSubview:_nicknameLabel];
    [self.contentView addSubview:_contentLabel];
    [self.contentView addSubview:_showNumLabel];
}

- (void)setModel:(FMDiantaiModel *)model
{
    _model = model;
    
    [_iconImageView sd_setImageWithURL:[NSURL URLWithString:model.cover] placeholderImage:nil completed:nil];
    _nicknameLabel.text = model.title;
    _contentLabel.text = model.content;
    _showNumLabel.text = [NSString stringWithFormat:@"节目 %@",model.fmnum];
    
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
